Many times, images, such as images taken by a digital camera or the digital camera component of a cellular phone, need to be corrected, enhanced, etc. A hardware image statistics collection unit collects statistics for data related to an image frame that has been received from the camera. The statistics are used by software to implement such functions as auto exposure, auto focus, auto white balance, and long exposure noise reduction.
A statistics collection unit may collect statistics on all three color components (R, G, B) simultaneously and for different programmable frame regions. A typical set of statistics may include total color intensity value, maximum and minimum color value, a histogram of received color values and dark pixel values for noise characterization. Statistics collections operations may be performed on the incoming camera data typically after dead pixel correction.
The statistics collection unit is generally not required to be a destination for data, but instead snoops image data as it passes by on the image data bus. The statistics collection unit does not store the image data, but rather it stores statistics derived from the data, generally only temporarily. Therefore, statistics collection may be performed in parallel with other operations or as a stand-alone operation. While data is received on the image data bus, statistics are calculated and then stored in a memory array and/or registers accessible by software and/or firmware.
The general behavior of a statistics collection unit is to collect data for one frame and then block new data until the statistics memory has been read and cleared, i.e., the statistics have been transferred to system memory and the statistics have been cleared from the temporary memory of the statistics collection unit. Alternatively, a statistics collection unit could be configured to collect data over multiple frames, and at the end of a programmed number of frames, new data may be blocked until after the statistics memory has been read and cleared.
As an example, a statistics collection unit may collect statistics for eight regions of an image frame for each color component. It generally collects the total color intensity value, maximum and minimum color value and a 32-bit histogram of received color values. As previously mentioned, the statistics may be stored in a combination of registers and memory arrays. In order for software and/or firmware to use the statistics, the data must be transferred from the local statistics collection unit memory to the system main memory via, for example, a direct memory access (DMA) operation. Those skilled in the art will understand that there are other ways to transfer the data from the local statistics collection unit memory to the system main memory. For example, the data from the local statistics collection unit memory may be transferred to the system main memory via programmed input/output (PIO). The local memory of the collection unit must then be cleared after the statistics data are transferred to main memory so that statistics for a new frame may be collected.
At the end of an image frame, the statistics collection unit generally must block the updating of the statistics until after the data is transferred to system memory and the local statistics memory is reset. The statistics collection unit may not be able to capture data for every frame because of the time required to transfer the data from local memory to system memory and the time required to clear the statistics. It may only be able to collect statistics for every other frame or possibly even worse, depending upon the memory transfer time, the memory clearing time, the delay between frames, the size of frames, and the frame rate. In some cases, the software algorithms may need to associate a set of image statistics to the specific image frame from which it was captured. There may be multiple image frames and multiple sets of image statistics in memory, and in this case, the software needs some way to determine which set of statistics belongs to which frame.
In the prior art, there needed to be some way to determine the frame to which a set of statistics corresponds and thus, the image statistics collection unit needed to guarantee a specific frame rate or else the software for statistics collection would need to receive an interrupt every time a new image frame and corresponding set of statistics were written to system memory. Such an implementation is dependent upon the reliability of the hardware to store the statistics at a consistent rate or on the ability of the software to properly match the statistics with the image data using an interrupt mechanism. Such a method is generally unreliable and costly in the case of interrupting the software for every set of image statistics.